import UIKit

// if else
var age = 10

if num > 1 {
    print("if")
}

while num > 10 {
    num+=1
}

let qujian = 1...3
for i in qujian {
    print(i)
}

for i in 1...3 {
    print(i)
}

let range1:ClosedRange<Int> = 1..3
let range2:Range<Int> = 1..<3
let range3:PartialRangeThrough<Int> = ...5


//字符串

let a = 'A' //默认是String型
let aa:String = 'AA'
let aaa:Character = 'JJ'

//switch  中多了一个fallthrough

var number = 1
switch number {
case 1:
    print('1')
    fallthrough //执行完print 可以继续执行下一步操作 case 2
case 2:
    print('2')
case 3:
    print('3')
default:
    print('Number is other')
    break
}

//区间匹配 元祖匹配
let count =32
switch count {
case 0:
    print('')
case 1..<5:
    print('')
default:
    print('')


let point = (1,1)

switch point {
    case (1,1):
        print('')
case (_,1):
    print('')
case (-2..2,1..3):
    print('')
    default:
        print('')
}

//值绑定

let point = (2,1)

switch point {
    case (1,1):
        print('')
    case (let x,1):
        //只要y 符合条件就可以 x= 2
        print('\(x)')
    case (-2..2,let y):
        print('\(y)')
    default:
        print('')
}


//where
